package com.matt.controller.web;

import com.matt.commons.model.StatusResponse;
import com.matt.foundation.query.BirthdayRecordQuery;
import com.matt.foundation.vo.BirthdayRecordPageVo;
import com.matt.service.BirthdayRecordService;

import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * *******************************
 * Created by Ron.
 * form com.matt
 * on 2017/9/22
 * *******************************
 */
@RestController
@RequestMapping("/web/birthday_record")
public class WebBirthdayRecordController {

    @Autowired
    private BirthdayRecordService birthdayRecordService;

    @ApiOperation(value = "生日会列表",httpMethod = "POST")
    @ApiImplicitParams({
    	@ApiImplicitParam(paramType = "header", name = "ticket", value = "票据", required = true, dataType = "string"),
		@ApiImplicitParam(paramType = "query", name = "childrenId", value = "宝宝id", required = true, dataType = "string"),
		@ApiImplicitParam(paramType = "query", name = "pageSize", value = "每页条数", required = false, dataType = "integer"),
		@ApiImplicitParam(paramType = "query", name = "pageNumber", value = "当前页码", required = false, dataType = "integer"),

    })
    @ApiResponses({
  		@ApiResponse(code = 000000, message = "成功"),
  		@ApiResponse(code = 000001, message = "ticket已过期")
  	}) 
    @RequestMapping("/page")
    public StatusResponse page(BirthdayRecordQuery query) {
        Page<BirthdayRecordPageVo> page = birthdayRecordService.getBirthdayRecordByChildren(query);
        return StatusResponse.success(page);
    }

}
